#!/bin/bash

# 判断文件夹是否存在  
if [ -d "/root/feeyoadsb" ]; then  
    rm -r "/root/feeyoadsb"  
else  
    # 创建文件夹  
    mkdir /root/feeyoadsb  
    echo "文件夹 /root/feeyoadsb 已创建"  
fi
cd feeyoadsb
wget https://gitee.com/fan0225/ADSB-scripts/raw/main/feeyo-adsb-golang-linux-armv7    
wget https://gitee.com/fan0225/ADSB-scripts/raw/main/conf.ini
read -p "请输入你的 UUID：" uuid
sed -i -e "/你的UUID/s/.*/UUID=$uuid/" /root/feeyoadsb/conf.ini
echo "$uuid" > /root/feeyoadsb/UUID
sed -i -e "/你的UUID是/s/.*/<a>你的UUID是：$uuid<\/a>/" /usr/local/share/tar1090/html/index.html

chmod +x feeyo-adsb-golang-linux-armv7

sudo tee /etc/systemd/system/feeyo-adsb.service > /dev/null <<EOF

[Unit]

Description=Feeyo ADS-B Service

After=network.target



[Service]

ExecStart=/root/feeyoadsb/feeyo-adsb-golang-linux-armv7

WorkingDirectory=/root/feeyoadsb

Restart=always

User=root



[Install]

WantedBy=multi-user.target

EOF

sudo systemctl daemon-reload

sudo systemctl enable feeyo-adsb.service

echo "-------------安装完成，你的UUID是$uuid，10秒后重启-------------------" && sleep 10 && reboot
